<?php 

		$records = array();
		$q = Doctrine::getTable('message')
			->createQuery('m')
			->select('m.public, m.description, p.name, m.created_at')
			->innerJoin('m.personne p')
			->addWhere('m.ownerclass = ?', 'client')
			->addWhere('m.owner_id= ? ', $self->id);
		$q->setHydrationMode(Doctrine_Core::HYDRATE_ARRAY);
		$q->addOrderBy('m.created_at desc');
		if(isset($limit)){
			$q->limit($limit);
		}
		$records =	$q->execute();
		
		if(count($records)>0)
		{			
?>

			<fieldset>
				<legend><?php echo __('Messages')?></legend>
			<?php	
				foreach($records as $records_list)
				{
						$culture = sfContext::getInstance()->getUser()->getCulture(); 
		  				$dateFormatter = new sfDateFormat($culture);
		  				
						
						echo '<b>' .$dateFormatter->format($records_list['created_at'], 'd/M/y').' - ' . $records_list['personne']['name'] . ' dit :</b><br />';
			?>
						<div class="message">
			<?php
						echo nl2br($records_list['description']);
			?>
						</div>
			<?php
				}
			?>
		</fieldset>
<?php
		}
?>
